package org.makcro.sms.services.chat.web.client.widgets;

import org.makcro.sms.services.chat.web.shared.dto.QuestionDto;

import com.extjs.gxt.ui.client.core.Template;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.Params;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;

public class NewMessageTextRendererImpl implements GridCellRenderer<QuestionDto> {
	
	private Template	gridTemplate	= new Template( "<p style='white-space:normal'>{messageText}</p>" );
	
	@Override
	public Object render(QuestionDto model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<QuestionDto> store, Grid<QuestionDto> grid) {
		String messageText = gridTemplate.applyTemplate( new Params( "messageText", model.getQuestion() ) );
		return messageText;
	}

}
